oracle.pgx.config

## Class ConfigParser<F extends ConfigField>

- java.lang.Object
- - oracle.pgx.config.AbstractConfigParser<F>
  - - oracle.pgx.config.ConfigParser<F>

- Type Parameters:
    `F` - the field enum this parsers uses
  All Implemented Interfaces:
    ParseResult<F>

      public class ConfigParser<F extends ConfigField>
      extends AbstractConfigParser<F>
      implements ParseResult<F>

  A parser for parsing graph configurations in JSON format.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `MAX_HEAP_SIZE_WILDCARD` The Constant MAX_HEAP_SIZE_WILDCARD.
    `static String` | `NEGATIVE_INFINITY_WILDCARD` The Constant NEGATIVE_INFINITY_WILDCARD.
    `static String` | `NO_OF_CPUS_WILDCARD` The Constant NO_OF_CPUS_WILDCARD.
    `static String` | `PGX_VERSION_WILDCARD` The Constant PGX_VERSION_WILDCARD.
    `static String` | `POSITIVE_INFINITY_WILDCARD1` The Constant POSITIVE_INFINITY_WILDCARD1.
    `static String` | `POSITIVE_INFINITY_WILDCARD2` The Constant POSITIVE_INFINITY_WILDCARD2.
    `static String` | `TMP_DIR_WILDCARD` The Constant TMP_DIR_WILDCARD.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<F>` | `getDefaults()` Gets the set of optional fields whose defaults where used during parsing.
    `Map<F,Object>` | `getValues()` Gets the parsed values.
    `ParseResult<F>` | `parse()` Starts parsing.
    `static <F extends ConfigField> ParseResult<F>` | `parse(Map<String,Object> raw, F[] fields, boolean strict, File parent)` Parses raw key/value pairs into a `ParseResult` object.
    `static Map<String,Object>` | `parseRaw(InputStream is)` Parses an input stream into raw key/value pairs.
    `static Object` | `replaceWildcards(Class<?> type, Object given)` Replaces a given wildcard value with the value the wildcard represents.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAX_HEAP_SIZE_WILDCARD

          public static final String MAX_HEAP_SIZE_WILDCARD

      The Constant MAX_HEAP_SIZE_WILDCARD.
      See Also:
        Constant Field Values

    - #### NEGATIVE_INFINITY_WILDCARD

          public static final String NEGATIVE_INFINITY_WILDCARD

      The Constant NEGATIVE_INFINITY_WILDCARD.
      See Also:
        Constant Field Values

    - #### NO_OF_CPUS_WILDCARD

          public static final String NO_OF_CPUS_WILDCARD

      The Constant NO_OF_CPUS_WILDCARD.
      See Also:
        Constant Field Values

    - #### PGX_VERSION_WILDCARD

          public static final String PGX_VERSION_WILDCARD

      The Constant PGX_VERSION_WILDCARD.
      See Also:
        Constant Field Values

    - #### POSITIVE_INFINITY_WILDCARD1

          public static final String POSITIVE_INFINITY_WILDCARD1

      The Constant POSITIVE_INFINITY_WILDCARD1.
      See Also:
        Constant Field Values

    - #### POSITIVE_INFINITY_WILDCARD2

          public static final String POSITIVE_INFINITY_WILDCARD2

      The Constant POSITIVE_INFINITY_WILDCARD2.
      See Also:
        Constant Field Values

    - #### TMP_DIR_WILDCARD

          public static final String TMP_DIR_WILDCARD

      The Constant TMP_DIR_WILDCARD.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getDefaults

          public Set<F> getDefaults()

      Description copied from interface: `ParseResult`
      Gets the set of optional fields whose defaults where used during parsing.
      Specified by:
        `getDefaults` in interface `ParseResult<F extends ConfigField>`
      Returns:
        the defaults

    - #### getValues

          public Map<F,Object> getValues()

      Description copied from interface: `ParseResult`
      Gets the parsed values.
      Specified by:
        `getValues` in interface `ParseResult<F extends ConfigField>`
      Returns:
        the values (includes default values)

    - #### parse

          public ParseResult<F> parse()

      Starts parsing.
      Returns:
        parsing result

    - #### parse

          public static <F extends ConfigField> ParseResult<F> parse(Map<String,Object> raw,
                                                     F[] fields,
                                                     boolean strict,
                                                     File parent)

      Parses raw key/value pairs into a `ParseResult` object.
      Type Parameters:
        `F` - the field enum this parsers uses
      Parameters:
        `raw` - the raw key/value input pairs
        `fields` - the fields to use for parsing
        `strict` - the strict if true, parses in strict mode
        `parent` - the parent to resolve relative paths against
      Returns:
        the parsing result
      Throws:
        `IllegalArgumentException` - if any input errors are encountered during parsing. Non-critical errors won't resolve in an exception if not parsing in strict mode.

    - #### parseRaw

          public static Map<String,Object> parseRaw(InputStream is)
                                             throws IOException

      Parses an input stream into raw key/value pairs.
      Parameters:
        `is` - the input stream
      Returns:
        the raw key/value parise
      Throws:
        `IOException` - Signals that an I/O exception has occurred.

    - #### replaceWildcards

          public static Object replaceWildcards(Class<?> type,
                                Object given)

      Replaces a given wildcard value with the value the wildcard represents.
      Parameters:
        `type` - the type of given value
        `given` - the given value, must not be `null`
      Returns:
        the value of given wildcard. If given value is not a wildcard, given value is returned as is.

Copyright © 2015. All rights reserved.